<template>
	<view>
		<swiperSearch :topList="info.postSlide" name="infomation" keyName="img"></swiperSearch>
		<view class="warning">
			<image src="../../../static/information/Warning.png" mode=""></image>
			{{info.submitPrompt}}
		</view>
		<!-- <view class="warning">
			<image src="../../../static/information/Warning.png" mode=""></image>
			{{info.warmTips}}
		</view> -->
		<view class="list_box">
			<view class="title">
				CATEGORY
			</view>
			<view class="item_box">
				<view class="items" v-for="item in list" @click="goinfo(item)">
					<image class="items_pho" :src="item.icon" mode=""></image>
					<view class="items_cn">
						{{item.name}}
					</view>
				</view>
			</view>
			<u-popup :show="show" @close="close" @open="open">
				<view class="list">
					<view style="margin-top: 20rpx;" v-for="(item,index) in conlist">
						<u-button :text="item.name" shape="circle" @click="goyes(item)"></u-button>
					</view>
					<view style="margin-top: 20rpx;">
						<u-button type="primary" shape="circle" @click="Cancel" :plain="true" text="Cancel"></u-button>
					</view>
				</view>
			</u-popup>
		</view>
	</view>
</template>

<script>
	import swiperSearch from "@/components/swiper-search.vue"
	export default {
		components: {
			swiperSearch,
		},
		data() {
			return {
				info: {},
				list: [],
				show: false,
				conlist: []
			}
		},
		methods: {
			goyes(item) {
				console.log(item)
				uni.navigateTo({
					url: '/pages/information/dayareleasei/index?fid=' + item.fid + '&id=' + item.id
				})
			},
			Cancel() {
				this.show = false
			},
			open() {
				// console.log('open');
			},
			close() {
				this.show = false
				// console.log('close');
			},
			goinfo(item) {
				console.log(item)
				if (item.second.length < 1) {
					uni.navigateTo({
						url: '/pages/information/dayareleasei/index?fid=' + '' + '&id=' + item.id
					})
				} else {
					this.show = true
					this.conlist = item.second
				}

			},
			getlist() {
				const params = {
					map: 'applet_city_category_list',
				}
				this.$Request({
					method: 'GET',
					data: params
				}).then(res => {
					if (res.data.ec == 200) {
						this.list = res.data.data
					} else {

					}
				})
			},
			geiswpier() {
				const params = {
					map: 'applet_city_cfg',
				}
				this.$Request({
					method: 'GET',
					data: params
				}).then(res => {
					if (res.data.ec == 200) {
						this.info = res.data.data
					} else {

					}
				})
			},
		},
		onLoad() {
			this.geiswpier()
			this.getlist()
		},
	}
</script>

<style lang="scss">
	.list {
		padding: 20rpx 30rpx;
	}

	.warning {
		margin: 30rpx 20rpx;
		background-color: #d3eaff;
		color: #389eff;
		font-size: 26rpx;
		vertical-align: middle;
		border-radius: 10rpx;
		padding: 20rpx;

		image {
			width: 50rpx;
			height: 40rpx;
			vertical-align: middle;
		}
	}

	.list_box {
		padding: 30rpx 40rpx 40rpx;

		.title {
			text-align: center;
			font-size: 32rpx;
			font-weight: 600;
			margin-bottom: 20rpx;
		}

		.item_box {
			display: flex;
			text-align: center;
			padding: 30rpx 0rpx;
			flex-wrap: wrap;

			.items {
				width: 25%;
				margin-bottom: 30rpx;
				font-size: 26rpx;
				color: #4c4c4c;

				.items_pho {
					width: 110rpx;
					height: 110rpx;
					border-radius: 50%;
					margin: 0 auto;
					margin-bottom: 15rpx;
				}

				.items_cn {
					font-size: 24rpx;
					color: #333;
				}
			}
		}
	}
</style>
